package com.wondream.myframework.design_pattern.proxy;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ProxyClient implements IClient {

    private IClient realClient;

    private void beforeRequest(){
        System.out.println("<== ProxyClient.beforeRequest ==>");
    }

    private void afterRequest(){
        System.out.println("<== ProxyClient.afterRequest ==>");
    }

    @Override
    public void request() {
        beforeRequest();
        realClient.request();
        afterRequest();
    }

    public static void main(String[] args) {
        ProxyClient proxyClient = new ProxyClient(new RealClient());
        proxyClient.request();
    }
}
